package com.ruihu.admin.constant;

import java.util.Arrays;
import java.util.Optional;

public enum NodeConfigTypeEnum {

    INPUT(1, "输入框"),
//    RADIO(2, "单选框"),
    SELECT(3, "OK/NOK选择"),
    TEXTAREA(4, "文本域框"),
    INPUT_SELECT(5, "输入与OK/NOK选择"),
    LABEL(99, "标签");


    private Integer code;

    private String message;


    NodeConfigTypeEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public static NodeConfigTypeEnum selectByValue(Integer value) {
        Optional<NodeConfigTypeEnum> first = Arrays.stream(NodeConfigTypeEnum.values()).filter(e -> e.getCode().equals(value)).findFirst();
        return !first.isPresent() ? null : first.get();
    }
}
